package com.cml.getway.discovery.api;


import com.cml.getway.common.util.*;
import java.util.List;


public interface Registry {

	/**
	 * 	/services: 是要存储所有的服务定义信息的：ServiceDefinition (永久存储)
	 */
	String SERVICE_PREFIX = "/services";
	
	/**
	 * 	/instances: 是要存储所有的服务实例信息的： ServiceInstance (加载时存储)
	 */
	String INSTANCE_PREFIX = "/instances";
	
	/**
	 * 	/rules: 是要存储所有的规则信息的：Rule (永久存储)
	 */
	String RULE_PREFIX = "/rules";
	
	/**
	 * 	/gateway: 这个是要存储所有的网关本身自注册信息的： rapid-core(网关服务本身，加载时存储)
	 */
	String GATEWAY_PREFIX = "/gateway";
	
	String PATH = "/";
	

	void registerPathIfNotExists(String path, String value, boolean isPersistent) throws Exception;
	

	long registerEphemeralNode(String key, String value) throws Exception;
	

	void registerPersistentNode(String key, String value) throws Exception;
	

	List<Pair<String, String>> getListByPrefixKey(String prefix) throws Exception;
	

	Pair<String, String> getByKey(String key) throws Exception;
	

	boolean isExistKey(String key) throws Exception;
	

	void deleteByKey(String key);
	

	void close();
	
}
